let isObject = function (target) {
	if (target) {
		if (Object.prototype.toString.call(target) === "[object Object]") {
			return true;
		}
	}
}

// let target = {};
function deep(origin) {
	let target = {};
	let key;
	for (key in origin) {
		if (isObject(origin[key])) {
			//是对象
			let obj = deep(origin[key], {});
			target[key] = obj;
		} else if (Array.isArray(origin[key])) {
			//是数组
			let array = (function (a) {
				let arr = [];
				let fn = arguments.callee;
				a.forEach(item => {
					if (Array.isArray(item)) {
						arr.push(fn(item));
					} else {
						arr.push(item);
					}
				});
				return arr;
			})(origin[key]);
			target[key] = array;
		} else {
			target[key] = origin[key];
		}
	}
	return target;
}

export default deep;